using System;

namespace ERP.Classes
{
	/// <summary>
	/// Summary description for csStringToken.
	/// </summary>
	public class csStringToken
	{
		//private string data,delim;
		private string[] tokens;
		public csStringToken()
		{
			Init("","");
			//
			// TODO: Add constructor logic here
			//
		}
		public void Init(string s, string dlim)
		{
			this.tokens=s.Split(dlim.ToCharArray());
			//
			// TODO: Add constructor logic here
			//
		}
		public string Element(int index)
		{
			if (index<tokens.Length)
			{
				return tokens[index];
			}
			else
			{
				return "";
			}
		}
		public int NumOfElement()
		{
			return tokens.Length;
		}
		public string FormatProperCase(string s)
		{
			string s1;
			s1="";
			s=s.Trim();
			s=s.Trim();
			this.Init(s," ");

			for (int i=0;i<this.tokens[i].Length;i++)
			{
				this.tokens[i][0].ToString().ToUpper();
				s1=s1+this.tokens[i] + " ";
			}

			return s1.Trim();
		}

		public string FormatToLower(string s)
		{
			return s.Trim().ToLower();
		}

		public string FormatToUpper(string s)
		{
			return s.Trim().ToUpper();
		}
	}
}
